﻿<%@ Page Title="" Language="C#" MasterPageFile="~/site.Master" AutoEventWireup="true" CodeBehind="HoaDonNhapThuoc.aspx.cs" Inherits="QLHieuThuocFull.HoaDonNhapThuoc" %>

<%@ Register Assembly="DevExpress.Web.v14.1, Version=14.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.v14.1, Version=14.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table style="width: 100%;">
        <tr>
            <td colspan="3">
                &nbsp;
            <dx:ASPxGridView ID="gridHDN" ClientInstanceName="gridHDN" runat="server" 
                    AutoGenerateColumns="False" Caption="Hóa đơn nhập thuốc" 
                    DataSourceID="HDNhapSource" KeyFieldName="MAHD">
                
                <Columns>
                    <dx:GridViewCommandColumn ShowClearFilterButton="True" ShowDeleteButton="True" 
                        ShowEditButton="True" ShowNewButtonInHeader="True" VisibleIndex="0">
                    </dx:GridViewCommandColumn>
                    <dx:GridViewDataTextColumn Caption="Nơi nhận" FieldName="NOINHAN" 
                        VisibleIndex="6">
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="Chiết khấu" FieldName="CHIETKHAU" 
                        VisibleIndex="9">
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="Thuế" FieldName="THUE" VisibleIndex="10">
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="VAT" FieldName="VAT" VisibleIndex="12">
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataDateColumn Caption="Ngày nhập" FieldName="NGAYNHAP" 
                        VisibleIndex="5" Width="100px">
                        <PropertiesDateEdit DisplayFormatString="">
                        </PropertiesDateEdit>
                    </dx:GridViewDataDateColumn>
                    <dx:GridViewDataDateColumn Caption="Ngày lập" FieldName="NGAYLAP" 
                        VisibleIndex="4" Width="100px">
                        <PropertiesDateEdit DisplayFormatString="">
                        </PropertiesDateEdit>
                    </dx:GridViewDataDateColumn>
                    <dx:GridViewDataComboBoxColumn Caption="Nhà cung cấp" FieldName="MANCC" 
                        VisibleIndex="8" Width="100px">
                        <PropertiesComboBox DataSourceID="NHACCSource" TextField="TENNCC" 
                            ValueField="MANCC">
                        </PropertiesComboBox>
                    </dx:GridViewDataComboBoxColumn>
                    <dx:GridViewDataCheckColumn Caption="Đã thanh toán" FieldName="THANHTOAN" 
                        VisibleIndex="13">
                    </dx:GridViewDataCheckColumn>
                    <dx:GridViewDataTextColumn Caption="Mã HD" FieldName="MAHD" VisibleIndex="3" 
                        Width="70px">
                    </dx:GridViewDataTextColumn>
                </Columns>
                <SettingsBehavior ConfirmDelete="True" />
                <SettingsEditing Mode="PopupEditForm">
                </SettingsEditing>
                <Settings ShowFilterRow="True" ShowGroupPanel="True" />
                <SettingsText ConfirmDelete="Bạn có muốn xóa không?" />
                <SettingsDetail AllowOnlyOneMasterRowExpanded="True" ShowDetailRow="True" />
                <SettingsCommandButton>
                    <NewButton Text="Thêm mới">
                    </NewButton>
                    <UpdateButton Text="Cập nhật">
                    </UpdateButton>
                    <CancelButton Text="Hủy">
                    </CancelButton>
                    <EditButton Text="Sửa">
                    </EditButton>
                    <DeleteButton Text="Xóa">
                    </DeleteButton>
                    <ClearFilterButton Text="Xóa lọc">
                    </ClearFilterButton>
                </SettingsCommandButton>
                <Templates>
                    <DetailRow>
                        <dx:ASPxGridView ID="gridDetail" runat="server" AutoGenerateColumns="False" 
                            Caption="CHI TIẾT HÓA ĐƠN" DataSourceID="CTHDNhapSource" 
                            KeyFieldName="MAHD;MATHUOC" 
                            onbeforeperformdataselect="ASPxGridView1_BeforePerformDataSelect" 
                            onrowinserting="ASPxGridView1_RowInserting">
                            <Columns>
                                <dx:GridViewCommandColumn ShowDeleteButton="True" ShowEditButton="True" 
                                    ShowNewButtonInHeader="True" VisibleIndex="0">
                                </dx:GridViewCommandColumn>
                                <dx:GridViewDataTextColumn Caption="Số lô" FieldName="SOLO" VisibleIndex="3">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="Số lượng" FieldName="SOLUONG" 
                                    VisibleIndex="6">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="Đơn giá" FieldName="DONGIA" 
                                    VisibleIndex="9">
                                    <PropertiesTextEdit DisplayFormatString="c">
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataComboBoxColumn Caption="Tên thuốc" FieldName="MATHUOC" 
                                    VisibleIndex="2">
                                    <PropertiesComboBox DataSourceID="ThuocSource" TextField="TENTHUOC" 
                                        ValueField="MATHUOC">
                                    </PropertiesComboBox>
                                </dx:GridViewDataComboBoxColumn>
                                <dx:GridViewDataDateColumn Caption="Hạn sử dụng" FieldName="HANSD" 
                                    VisibleIndex="5">
                                    <PropertiesDateEdit DisplayFormatString="">
                                    </PropertiesDateEdit>
                                </dx:GridViewDataDateColumn>
                                <dx:GridViewDataComboBoxColumn Caption="Đơn vị nhập" FieldName="DVNHAP" 
                                    VisibleIndex="8">
                                    <PropertiesComboBox DataSourceID="DVTSource" TextField="TENDVT" 
                                        ValueField="MADVT">
                                    </PropertiesComboBox>
                                </dx:GridViewDataComboBoxColumn>
                                <dx:GridViewDataTextColumn Caption="Thành tiền" FieldName="TOTAL" 
                                    UnboundExpression="SOLUONG*DONGIA" UnboundType="Decimal" VisibleIndex="10">
                                </dx:GridViewDataTextColumn>
                            </Columns>
                            <SettingsCommandButton>
                                <NewButton Text="Thêm mới">
                                </NewButton>
                                <UpdateButton Text="Cập nhật">
                                </UpdateButton>
                                <CancelButton Text="Hủy">
                                </CancelButton>
                                <EditButton Text="Sửa">
                                </EditButton>
                                <DeleteButton Text="Xóa">
                                </DeleteButton>
                                <ClearFilterButton Text="Xóa lọc">
                                </ClearFilterButton>
                            </SettingsCommandButton>
                        </dx:ASPxGridView>
                    </DetailRow>
                </Templates>
    </dx:ASPxGridView>
                &nbsp;
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
                </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;<asp:LinqDataSource ID="ThuocSource" runat="server" 
                    ContextTypeName="QLHieuThuocFull.QLDUOCDataContext" TableName="THUOCs">
                </asp:LinqDataSource>
                <asp:LinqDataSource ID="CTHDNhapSource" runat="server" 
                    ContextTypeName="QLHieuThuocFull.QLDUOCDataContext" EnableDelete="True" 
                    EnableInsert="True" EnableUpdate="True" TableName="CT_HD_NHAPTHUOCs">
                </asp:LinqDataSource>
&nbsp;<asp:LinqDataSource ID="HDNhapSource" runat="server" 
                    ContextTypeName="QLHieuThuocFull.QLDUOCDataContext" EnableDelete="True" 
                    EnableInsert="True" EnableUpdate="True" TableName="HD_NHAPTHUOCs">
                </asp:LinqDataSource>
                <asp:LinqDataSource ID="DVTSource" runat="server" 
                    ContextTypeName="QLHieuThuocFull.QLDUOCDataContext" TableName="DVTINHs">
                </asp:LinqDataSource>
                <asp:LinqDataSource ID="NHACCSource" runat="server" 
                    ContextTypeName="QLHieuThuocFull.QLDUOCDataContext" TableName="NHACCs">
                </asp:LinqDataSource>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    </asp:Content>
